OCI runtime create failed

您所在的位置:网站首页 loaded in cont OCI runtime create failed

OCI runtime create failed

2023-04-24 02:53| 来源: 网络整理| 查看: 265

起因是 Fedora 更新了 containerd.io 这个包。 环境信息是

Docker Engine Fedora 34

完整的报错如下:

# docker start d8eb1107cebb Error response from daemon: OCI runtime create failed: container_linux.go:380: starting container process caused: process_linux.go:545: container init caused: process_linux.go:508: setting cgroup config for procHooks process caused: cannot fetch program from id: get program by id: permission denied: unknown Error: failed to start containers: d8eb1107cebb

报错问题很明显,大概就是 permission denied,但是守护服务是使用 root 启用的,所以肯定不是 avc 的问题,看来问题大概是出现在 SELinux 上,但是遗憾的是 cat /var/log/audit/audit.log | audit2why 输出为空,也就是说 SELinux 并没有拦截 Docker 的记录。

在 解决一个在实际工作部署 的一个问题 “OCI runtime create failed“ 中作者同样出现这个问题,是使用关闭 SELinux 实现的,现在我试一下:

setenforce 0 docker start d8eb1107cebb

成功!这里就很奇怪,明明 SELinux 没有拦截记录,结果问题却出现在 SELinux 上。

这里有些尴尬,我为了以防万一,关机前看了一下 auditd.service ,发现它并没有 enable。。。但是竟然还有 audit 的日志,就非常奇怪。我说怎么这几天没看到警报

把 SELinux 改到抱怨模式, enable auditd.service ,然后重启。一开机就弹出来一个警告:

# cat /var/log/audit/audit.log | audit2why type=AVC msg=audit(1626855919.807:979): avc: denied { prog_run } for pid=3802 comm="runc" scontext=system_u:system_r:container_runtime_t:s0 tcontext=system_u:system_r:init_t:s0 tclass=bpf permissive=1 Was caused by: Missing type enforcement (TE) allow rule. You can use audit2allow to generate a loadable module to allow this access. type=AVC msg=audit(1626855920.120:998): avc: denied { prog_run } for pid=3905 comm="runc" scontext=system_u:system_r:container_runtime_t:s0 tcontext=system_u:system_r:init_t:s0 tclass=bpf permissive=1 Was caused by: Missing type enforcement (TE) allow rule. You can use audit2allow to generate a loadable module to allow this access.

问题已经很明显了,应该是 docker 更新后确实了 SELinux 的组件,自己重新做一个就行了:

mkdir -p /etc/selinux/custom cd /etc/selinux/custom cat /var/log/audit/audit.log | audit2allow -M docker rm docker.te semodule -i docker.pp

然后重启一遍看看效果

。。。 已经没有警告了,非常 nice。现在让我重新把 SELinux 打开。。。

systemd[1]: Freezing execution

2021-07-22

刚刚碰到一个很奇怪的问题:

在执行 docker run -it -vpwd:/workspace ubuntu /bin/sh 的时候,系统通知弹 systemd[1]: Freezing execution 当时没有在意,结果发现后面 docker 的操作直接卡死,然后发现 systemctl 操作也卡死。网上一搜,找到两个结果:

升级rhel8后systemd[1]: Freezing execution systemd[1]: Failed to load SELinux policy. freezing.

大意就是出现这个问题是 systemd 出问题了,但是它自己又不能重启自己,所以就报个错,让你自己重启系统。但是这可能有涉及到 SELinux 的锅了,众所周知,SELinux 出问题是一定不能乱重启的。先看看审计日志再说:

# cat /var/log/audit/audit.log | audit2why type=AVC msg=audit(1626925225.222:1256): avc: denied { write } for pid=13721 comm="systemd-coredum" name="core_pattern" dev="proc" ino=15477 scontext=system_u:system_r:systemd_coredump_t:s0 tcontext=system_u:object_r:usermodehelper_t:s0 tclass=file permissive=0 Was caused by: Missing type enforcement (TE) allow rule. You can use audit2allow to generate a loadable module to allow this access. # cat /var/log/audit/audit.log | audit2allow #============= systemd_coredump_t ============== allow systemd_coredump_t usermodehelper_t:file write;

看来是 systemd-coredump 上下文出问题了。。。

看一下 coredump:

# ls /var/lib/systemd/coredump core.systemd.0.405e70d4f58b4927a0f84e10854bdbad.5272.1626824957000000.zst core.systemd.0.cd25df8746344f4b8f20265276334916.245895.1626788113000000.zst core.systemd.0.dbe468c7311b43cbbf2f7ef74b855d93.13720.1626925225000000.zst

systemd coredump 了。重新安装一下: dnf reinstall systemd 这里失误了, dnf 这东西好像依赖于服务,结果全局的服务都挂了,这个跑不了,跑事务又不敢关闭,只能等他自己发现超时了再说吧。。。

事务概要 ================================================================================================================================ 总下载:4.4 M 安装大小:14 M 确定吗?[y/N]: y 下载软件包: systemd-248.4-1.fc34.x86_64.rpm 1.1 MB/s | 4.4 MB 00:03 -------------------------------------------------------------------------------------------------------------------------------- 总计 657 kB/s | 4.4 MB 00:06 运行事务检查 事务检查成功。 运行事务测试 事务测试成功。 运行事务 准备中 : 1/1 运行脚本: systemd-248.4-1.fc34.x86_64 1/2 重新安装: systemd-248.4-1.fc34.x86_64 1/2 运行脚本: systemd-248.4-1.fc34.x86_64 1/2 ^C^C^C^C^C ^C 清理 : systemd-248.4-1.fc34.x86_64 2/2 运行脚本: systemd-248.4-1.fc34.x86_64 2/2 ^CFailed to set unit properties on systemd-timedated.service: 连接超时 Failed to set unit properties on systemd-portabled.service: 连接超时 Failed to set unit properties on systemd-homed.service: 连接超时 Failed to set unit properties on systemd-hostnamed.service: 连接超时 Failed to set unit properties on systemd-journald.service: 连接超时 Failed to set unit properties on systemd-localed.service: 连接超时 Failed to set unit properties on systemd-userdbd.service: 连接超时 Failed to set unit properties on systemd-oomd.service: 连接超时

这真是。。。

这个问题应该不用管,先把 SELinux 挂到抱怨模式重启一下看看



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3